
package org.upt.dcda.db;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * The persistent class for the notifications database table.
 * 
 */
@Entity
@Table(name = "notifications")
@NamedQueries(value =
{ @NamedQuery(name = NotificationEntity.NOTIFICATION_GET_QUERY, query = "SELECT notification FROM NotificationEntity notification WHERE notification.book.bookQuantity > 0") })
public class NotificationEntity implements Serializable
{

	public static final String	NOTIFICATION_GET_QUERY	= "notification_get_all_query";

	private static final long	serialVersionUID		= 1L;

	private int					notificationsId;

	private BookEntity			book;

	private UserEntity			user;

	public NotificationEntity()
	{
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "notifications_id")
	public int getNotificationsId()
	{
		return this.notificationsId;
	}

	public void setNotificationsId(int notificationsId)
	{
		this.notificationsId = notificationsId;
	}

	// bi-directional many-to-one association to BookEntity
	@ManyToOne(cascade = CascadeType.REMOVE)
	@JoinColumn(name = "notifications_book_id")
	public BookEntity getBook()
	{
		return this.book;
	}

	public void setBook(BookEntity book)
	{
		this.book = book;
	}

	// bi-directional many-to-one association to UserEntity
	@ManyToOne(cascade = CascadeType.REMOVE)
	@JoinColumn(name = "notifications_user_id")
	public UserEntity getUser()
	{
		return this.user;
	}

	public void setUser(UserEntity user)
	{
		this.user = user;
	}

}
